import request from '@/utils/request'

// 核心指标-订单配车
export function getLogisticsCoreCareQuantity(date) {
  return request({
    url: '/app/v1/logistics/core/care-quantity',
    method: 'get',
    params: { date }
  })
}
// 核心指标-配车详情数据
export function getLogisticsCoreCarDetail(date) {
  return request({
    url: '/app/v1/logistics/core/deliveryCenter/care',
    method: 'get',
    params: { date }
  })
}

// 核心指标-办事处配车
export function getLogisticsOfficeCoreCareQuantity({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/core/care-quantity',
    method: 'get',
    params: { date, officeName }
  })
}
// 核心指标-办事处配车-详情数据
export function getLogisticsOfficeCoreCarDetail({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/deliveryCenter/care',
    method: 'get',
    params: { date, officeName }
  })
}

// 核心指标-物流启运(启运合同)
export function getLogisticsCoreShipQuantity(date) {
  return request({
    url: '/app/v1/logistics/core/ship-quantity',
    method: 'get',
    params: { date }
  })
}
// 核心指标-物流启运(启运合同)-明细
export function getLogisticsCoreShipContractDetail(date) {
  return request({
    url: '/app/v1/logistics/core/deliveryCenter/shipContract',
    method: 'get',
    params: { date }
  })
}

// 核心指标-物流实际启运
export function getLogisticsCorePracticalShipQuantity(date) {
  return request({
    url: '/app/v1/logistics/core/practical-ship-quantity',
    method: 'get',
    params: { date }
  })
}
// 核心指标-物流实际启运-明细
export function getLogisticsCorePracticalShipDetail(date) {
  return request({
    url: '/app/v1/logistics/core/practical-ship/detail',
    method: 'get',
    params: { date }
  })
}

// 核心指标-办事处物流启运(启运合同)
export function getLogisticsOfficeCoreShipQuantity({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/core/ship-quantity',
    method: 'get',
    params: { date, officeName }
  })
}
// 核心指标-办事处物流启运(启运合同)-明细
export function getLogisticsOfficeCoreShipContractDetail({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/deliveryCenter/shipContract',
    method: 'get',
    params: { date, officeName }
  })
}

// 核心指标-办事处物流实际启运
export function getLogisticsOfficeCorePracticalShipQuantity({
  date,
  officeName
}) {
  return request({
    url: '/app/v1/logistics/office/core/practical-ship-quantity',
    method: 'get',
    params: { date, officeName }
  })
}

/**
 *  办事处核心指标-物流实际启运-明细
 * @param {string} date  日期
 * @param {string} officeName   办事处名称
 * */
export function getLogisticsOfficeCorePracticalShipDetail({
  date,
  officeName
}) {
  return request({
    url: '/app/v1/logistics/office/core/practical-ship/detail',
    method: 'get',
    params: { date, officeName }
  })
}

// 核心指标-物流到车
export function getLogisticsCoreArriveQuantity(date) {
  return request({
    url: '/app/v1/logistics/core/arrive-quantity',
    method: 'get',
    params: { date }
  })
}
// 核心指标-物流到车详情
export function getLogisticsCoreArriveDetail(date) {
  return request({
    url: '/app/v1/logistics/core/deliveryCenter/arrive',
    method: 'get',
    params: { date }
  })
}

// 核心指标-办事处物流到车
export function getLogisticsOfficeCoreArriveQuantity({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/core/arrive-quantity',
    method: 'get',
    params: { date, officeName }
  })
}
// 核心指标-办事处物流到车-详情
export function getLogisticsOfficeCoreArriveDetail({ date, officeName }) {
  return request({
    url: '/app/v1/logistics/office/deliveryCenter/arrive',
    method: 'get',
    params: { date, officeName }
  })
}

// 本年总配车量
export function getLogisticsYearCareQuantity() {
  return request({
    url: '/app/v1/logistics/year/care-quantity',
    method: 'get'
  })
}

// 办事处-本年总配车量
export function getLogisticsOfficeYearCareQuantity(officeName) {
  return request({
    url: '/app/v1/logistics/office/year/care-quantity',
    method: 'get',
    params: { officeName }
  })
}

// 本年总启运量
export function getLogisticsYearShipQuantity() {
  return request({
    url: '/app/v1/logistics/year/ship-quantity',
    method: 'get'
  })
}

// 办事处-本年总启运量
export function getLogisticsOfficeYearShipQuantity(officeName) {
  return request({
    url: '/app/v1/logistics/office/year/ship-quantity',
    method: 'get',
    params: { officeName }
  })
}

// 配车地图-本月各办事处配车量
export function getLogisticsOfficeCareMap() {
  return request({
    url: '/app/v1/logistics/care/month/office',
    method: 'get'
  })
}
// 各办事处配车明细
export function getLogisticsOfficeCareTable() {
  return request({
    url: '/app/v1/logistics/office/care',
    method: 'get'
  })
}
// 启运地图-本月各办事处配车量 TODO
export function getLogisticsOfficeShipMap() {
  return request({
    url: '/app/v1/logistics/ship/month/office',
    method: 'get'
  })
}
// 各办事处启运明细
export function getLogisticsOfficeShipTable() {
  return request({
    url: '/app/v1/logistics/office/ship',
    method: 'get'
  })
}

// 近6月启运、配车
export function getSixMonthLogistics() {
  return request({
    url: '/app/v1/logistics/quantity/6month',
    method: 'get'
  })
}

// 办事处-近6月启运、配车 TODO:暂缺接口
export function getLogisticsOfficeSixMonth(officeName) {
  return request({
    url: '/app/v1/logistics/office/quantity/6month',
    method: 'get',
    params: { officeName }
  })
}

// 当月物流启运车数（每天的数量集合）
export function getShipQuantityCurrentMonth() {
  return request({
    url: '/app/v1/logistics/shipQuantity/currentMonth',
    method: 'get'
  })
}

// 办事处-当月物流启运车数（每天的数量集合） TODO:暂缺接口
export function getOfficeShipQuantityCurrentMonth() {
  return request({
    url: '/app/v1/logistics/office/shipQuantity/currentMonth',
    method: 'get'
  })
}

// 当月订单配车/待配车量趋势
export function getCareQuantityCurrentMonth() {
  return request({
    url: '/app/v1/logistics/trend/care/currentMonth',
    method: 'get'
  })
}

// 办事处-当月订单配车/待配车量趋势
export function getOfficeCareQuantityCurrentMonth(officeName) {
  return request({
    url: '/app/v1/logistics/office/trend/care/currentMonth',
    method: 'get',
    params: { officeName }
  })
}

// 各配送中心-订单配车量(日/月)
export function getDeliveryCenterCareDayMonth(date) {
  return request({
    url: '/app/v1/logistics/deliveryCenter/care/dayMonth',
    method: 'get',
    params: { date }
  })
}

// 各配送中心-物流启运量 (日/月)
export function getDeliveryCenterShipDayMonth(date) {
  return request({
    url: '/app/v1/logistics/deliveryCenter/ship/dayMonth',
    method: 'get',
    params: { date }
  })
}

//  物流 - 线路运价比率分析(车);
export function findFreightRateRatio(params) {
  return request({
    url:
            '/app/v1/logisticsStorage/distribution/freightSalesAmountRateAnalyzeCar',
    method: 'get',
    params
  })
}

//  物流 - 各办事处配车未请明细
export function findUninvitedCarDetails() {
  return request({
    url: '/app/v1/logisticsStorage/office/uninvitedCar',
    method: 'get'
  })
}
//  物流 - 各办事处请车未发明细;
export function findLeaveCarDetails() {
  return request({
    url: '/app/v1/logisticsStorage/office/leaveCar',
    method: 'get'
  })
}

//  物流 - 各办事处配车未请明细详情;
export function getUninvitedCarDetail(params) {
  return request({
    url: '/app/v1/logisticsStorage/office/uninvitedCarDetail',
    method: 'get',
    params
  })
}

//  物流 - 各办事处请车未发明细详情;
export function getLeaveCarDetail(params) {
  return request({
    url: '/app/v1/logisticsStorage/office/leaveCarDetail',
    method: 'get',
    params
  })
}
